Add FP8 host-side data types (E4M3/E5M2)#259
Merged
Merged
Conversation
…float8.{h,cpp}, register FP8_E4M3/FP8_E5M2 in data_type, add Python bindings, and write float8_test.cpp coverage. Rebase from PR #226 onto main.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #259 +/- ##
==========================================
+ Coverage 85.00% 85.48% +0.48%
==========================================
Files 127 129 +2
Lines 6181 6457 +276
==========================================
+ Hits 5254 5520 +266
- Misses 927 937 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…float8.{h,cpp}, register FP8_E4M3/FP8_E5M2 in data_type, add Python bindings, and write float8_test.cpp coverage. Rebase from PR #226 onto main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add FP8 host-side data types (E4M3/E5M2)
Add
float8_e4m3_tandfloat8_e5m2_thost-side types with floatconversion, arithmetic, comparison operators, and
std::numeric_limitsspecializations. Register
FP8_E4M3andFP8_E5M2in the data-typeregistry and expose them in the Python bindings.
Ported from PR #226 (
noli/fp8) with two correctness fixes:numeric_limits::lowest()returns −448.0 (0xfe), not +448.0.has_infinityset tofalse(OCP E4M3 has no infinity encoding).NumPy and PyTorch have no stable FP8 dtypes, so
np/torchmappingsare set to
Nonein the Python registry.New files:
ark/float8.h— templated_float8struct, E4M3/E5M2 type aliases.ark/float8.cpp— float↔FP8 conversion routines.ark/float8_test.cpp— 386-line test suite covering both types:round-trip, subnormals, ±zero, NaN, ±Inf, overflow saturation,
arithmetic, all comparison operators,
numeric_limitsinvariants.Changed files:
ark/api/data_type.cpp— register FP8_E4M3, FP8_E5M2.ark/include/ark/data_type.hpp— declare extern constants.python/data_type_py.cpp— pybind11 bindings.python/ark/data_type.py— Python-side constants.+1305/−0 across 7 files.